﻿using HLStock.Common;
using HLStock.Model;
using HLStock.WmsService;

namespace HLStock.ModelSetup
{
    public class StockOutSetup : IDefValSetter<StockRecordModel>
    {
        public void SetupModel(StockRecordModel t)
        {
            if (t.Type == StockType.In) return;
            var sp = ServiceLoader.GetService<StockRecordServiceProvider>();
            var srcStock = sp.Get(t.SrcRecord);
            t.QrCode = srcStock.QrCode;
            t.ProductCode = srcStock.ProductCode;
            t.ProductName = srcStock.ProductName;
            t.OrderCode = srcStock.OrderCode;
            t.PlaceId = srcStock.PlaceId;
            t.PlaceCode = srcStock.PlaceCode;
        }
    }
}
